Return to doc.sitecore.com

Valid for Sitecore 5.3.1
3.  Checklist and Multilist
Prev Next

The complex field types, Checklist and Multilist are stored as raw text in the Sitecore datbase: 

{E00D9E00-2582-4022-88AE-151CE3CD7C41}|{858D25B3-B8A6-4ED1-B6F8-B52C4CC0EFDF}  

Resolve the value by using implicit casting:

// The outMultitype method resolves Checklist, Multilist and Treelist types
  public static string outMultitype(Sitecore.Data.Items.Item item, string sFieldName)
  {
    System.Text.StringBuilder builder
= new System.Text.StringBuilder();

    Sitecore.Data.Fields.MultilistField multilistField
= item.Fields[sFieldName];
    builder.Append(
"<strong>" + item.Name + " links to:</strong>");
    builder.Append(
"<br />");
    
foreach (Sitecore.Data.Items.Item child in multilistField.GetItems())
    {
      builder.Append(
" * <a href='" + child.Paths.GetFriendlyUrl() + "'>" + child.DisplayName + "</a>");
      builder.Append(
"<br />");
    }

  
return builder.ToString();
  }

Result:  

MyNewItemName links to:
* Other selectable document
* updater


Prev Next